'''
解析文件里面的内容, 输出需要的结果

Created on Mar 21, 2016

@author: grind
'''
import sys
import os

def readfile(filename):
    f = open(filename, mode='r')
    mydict = {}
    pair=['','']
    count = 0
    for line in f :
        if count == 4:
            count = 0;
        #print(line, end='')
        if count == 0 :
            pair[0] = line.rstrip()
        elif count == 1 :
            pair[1] = line.rstrip()[2:]
        elif count == 3 :
            #mydict[pair[1]] = pair[0]
            print("insert stock.st_code values('%s', '%s'); " % (pair[1], pair[0]))
        count += 1
        
    f.close()
    
if __name__ == '__main__':
    #print(os.getcwd())
    filename = "zixun.txt"
    readfile(filename)